package game.buffovi;

import game.Character;


public class AddAttributeBuff extends Buff
{
	
	public enum Attribute 
	{
		Strength,Intelligence,Dexterity,Vitality
	}
	
	Attribute attribute;
	int value;
	boolean first = true;
	
	public AddAttributeBuff(int duration,int value,Attribute attribute,game.Character caster) 
	{
		super(duration,caster);
		this.attribute = attribute;
		this.value = value;
		
	}
	
	protected void DoBuff(Character target) 
	{
		if(first)
		{
			switch (attribute) 
			{
			case Strength:target.setBaseStrength(target.getStrength()+value); break;
			case Dexterity:target.setBaseDexterity(target.getStrength()+value); break;
			case Intelligence:target.setBaseIntelligence(target.getIntelligence()+value); break;
			case Vitality:target.setBaseVitality(target.getVitality()+value); break;
			}
			
			target.CalculateAttributes();
			first = false;
		}
		
		if(super.duration == 1) 
		{
			switch (attribute) 
			{
			case Strength:target.setBaseStrength(target.getStrength()-value); break;
			case Dexterity:target.setBaseDexterity(target.getStrength()-value); break;
			case Intelligence:target.setIntelligence(target.getIntelligence()-value); break;
			case Vitality:target.setBaseVitality(target.getVitality()-value); break;
			}
			
			target.CalculateAttributes();
		}
		
	}
}
